package com.xuecheng.feignclient;

import com.xuecheng.po.CoursePublish;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


@Slf4j
@Component
public class ContentServiceClientFallbackFactory implements FallbackFactory<ContentServiceClient> {
	@Override
	public ContentServiceClient create(Throwable throwable) {
		return courseId -> {
			log.error("远程调用内容管理服务熔断异常：{}", throwable.getMessage());
			return new CoursePublish();
		};
	}
}